In recent years, digital video cameras and. digital cameras which encode moving image data by using inter-frame encoding such as MPEG and record/reproduce the data are widely used.
In encoding image data by using MPEG, it is done in accordance with a virtual buffer model called vbv_buffer in order to guarantee that encoded image data will be decoded by a decoder without any loss. The decoder decodes image data input from a recording medium or transmission line in accordance with the vbv_buffer model.
An operation of reproducing, from a recording medium, image data encoded by MPEG and decoding it will be described with reference to FIGS. 5A to 5C and 6.
FIG. 6 is a block diagram showing an example of a reproduction apparatus. When a reproduction instruction is input, a control circuit 507 shown in FIG. 6 instructs a reproduction circuit 502 to reproduce, reads out a stream A of MPEG data recorded on a recording medium 501, and writes reproduced data in a buffer 503. As shown in FIG. 5A, the control circuit 507 reads out the stream A from the recording medium 501 at time ta and writes it in the buffer 503. The control circuit 507 notifies a decoding time calculation circuit 506 of the fetch time ta in the buffer 503.
At time t0 shown in FIG. 5A, the control circuit 507 reads out first image data V0 from the buffer 503 and sends the data to a decoder (not shown).
On the basis of vbv_delayA(0) detected by a vbv_delay detection circuit 504, the decoding time calculation circuit 506 calculates the time t0 given byt0=ta+vbv_delayA(0)   (1)The vbv_delay data is information representing a time during which each picture data of an MPEG stream stays in the buffer memory when the picture data is to be decoded.
The decoding time t0 calculated by the decoding time calculation circuit 506 is supplied to the control circuit 507. At the time t0, the control circuit 507 reads out the reproduced data V0 of the stream A from the buffer 503 and outputs the data from an output terminal 508 to a decoder (not shown).
Decoding time tq from the time t0 is calculated by the decoding time calculation circuit 506 bytq=t0+Tv×q(q=0, 1, 2, . . . )   (2)and supplied to the control circuit 507, where Tv is the reciprocal of the frame frequency (e.g., 29.97 Hz) of the image data.
When the time t0 has come, the control circuit 507 notifies the decoding time calculation circuit 506 of it. The decoding time calculation circuit 506 supplies next decoding time t1 to the control circuit 507.
At the time t1, the control circuit 507 reads out V1 of the stream A of the reproduced data fetched in the buffer 503, outputs the data to the output terminal 508, and sends it to the decoder (not shown).
In the above-described way, the image data is reproduced until times t2, t3, . . . , tn so that reproduction of the stream A is ended.
The encoder must encode image data without causing overflow or underflow of the above-described vbv_buffer model. The decoder can decode image data without any failure such as frame skip or frame hold by executing reproduction in accordance with the vbv_buffer model.
Consider a case wherein another stream B is reproduced next to the stream A recorded on the recording medium.
To reproduce without causing overflow or underflow of the vbv_buffer model on the decoder side, the control circuit 507 controls the reproduction circuit 502 and buffer 503 such that after the final reproduced data of the stream A is read out from the buffer 503 at decoding time tn the data of the stream B is fetched in the buffer 503, as shown in FIG. 5B.
The control circuit 507 notifies the decoding time calculation circuit 506 of the fetch time tn of the stream B and fetches the stream B in the buffer 503 through the reproduction circuit 502.
The vbv_delay detection circuit 504 detects vbv_delayB(0) and supplies it to the decoding time calculation circuit 506. On the basis of the fetch time tn and vbv_delayB(0), the decoding time calculation circuit 506 calculates a decoding time tm given bytm=tn+vbv_delayB(0)   (3)(tn+3=tm FIG. 5B) and supplies the decoding time tm to the control circuit 507.
The decoding time of the stream B is calculated by the decoding time calculation circuit 506 bytr=tn+Tv×r(r=0, 1, 2, . . . )   (4)The control circuit 507 controls the fetch/read in/from the buffer in the same way as for the stream A, as shown in FIG. 5B.
In the above-described method, neither buffer overflow nor underflow occurs because the stream B is fetched in the buffer 503 after the stream A is completely read out from the buffer 503 at the decoding time of the last data of the stream A. However, since decoding cannot be executed at the reproduction transition from the stream A to the stream B, i.e., at times tn+1 and tn+2, the reproduced image of the stream A cannot smoothly be switched to that of the stream B. That is, the continuity of a reproduced image is disrupted.
To solve this problem, Japanese Patent Laid-Open No. 2002-158968 proposes a technique in which fetch of the stream B in the buffer 503 is started from an end time te of fetch of the stream A in the buffer 503, as shown in FIG. 5C, to speed up fetch in the buffer 503 while stopping fetch in the buffer 503 if overflow is going to occur. The decoding time of the stream B is set at ts in FIG. 5C to shorten the time of discontinuity of a reproduced image (the time while the continuity of decoding times is damaged) as much as possible.
Although this method can solve the problem of interruption of the discontinuity of a reproduced image, there is still room for improvement.